home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
cstrings.arc
/
CENTERS.C
next >
Wrap
Text File
|
1985-08-06
|
1KB
|
51 lines
/*
CSTRINGS.LBR VERSION 1.0
Spark Software, Inc.
If you find this software of use, it is requested that you send
a donation ($10.00 suggested) to:
Spark Software, Inc.
24 Royal Crest Dr., #5
Nashua, NH 03060
Upon receiving your donation, your name will be added to the
List of Registered Users, and future updates can be obtained
from the SPARKIE RBBS at (603) 888-8179.
If you include an extra $10.00 with your donation, the newest
version of CSTRINGS.LBR will be mailed to you.
Call SPARKIE RBBS at the number above for other Spark Software
products!!!
*/
/*
* centers (sd, ss, n)
* char *sd, *ss;
* int n;
*
* This function centers string ss in the first n characters of sd.
*/
char *centers (sd, ss, n)
register char *sd, *ss;
int n;
{
int i, k, l;
l = strlen (ss);
k = (n - l) / 2;
if (k <= 0)
strncpy (sd, ss, n);
else {
for (i = 0; i < k; i++)
sd[i] = ' ';
strncpy (&sd[k], ss, l);
for (i = k + l; i < n; i++)
sd[i] = ' ';
}
sd[n] = '\0';
return (sd);
}